import App from './App'
import store from "@/store/index.js"
import uView from "uview-ui";
import noDatas from "./components/noDatas.vue"
import uNavbar from "./components/uNavbar.vue"
import renderPoster from "./components/renderPoster.vue"
import haiBao from "./components/haibao.vue" 
import atAddress from "./components/at-address.vue" 
Vue.use(uView);
Vue.component("noDatas", noDatas)
Vue.component("uNavbar", uNavbar)
Vue.component("renderPoster", renderPoster)
Vue.component("atAddress", atAddress)
Vue.component("haiBao", haiBao)
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	store,
  ...App
})
app.$mount()
// #endif

uni.getNetworkType({ //获取网络状态
	success: function(res) {
		Vue.prototype.$networkType = res.networkType;
		// console.log('网络状态1111',res.networkType);
		store.commit('SetNetworkType',res.networkType)
	}
});
uni.onNetworkStatusChange(function(res) { //监听网络状态变化
	Vue.prototype.$networkType = res.networkType;
	store.commit('SetNetworkType',res.networkType)
	// console.log(res.networkType,'1111111111111111111111');
	if (!res.isConnected) {
		uni.$u.toast('检查网络是否连接')
		uni.navigateTo({
			url:'/pages/login/network'
		})
	}
});

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif